
package cn.bluethink.eguan.model.core;

import com.fasterxml.jackson.annotation.JsonInclude;

/**
 * 系统内置角色
 * 
 * @title 角色对象
 * @Copyright 苏州中科蓝迪公司所有(c)2016-2021
 * @version 0.1
 *
 * @note 修订历史： （1）liuxn于2018年8月14日构建初始版本0.1 （2）giszyj@126.com于2018年10月06日增加内置角色
 */
public class EgRole {
    
    /** 角色：商人 */
	public static final int TRADER = 1; 
	/** 角色：侠客 */
	public static final int TRAVELER = 2; 
	/** 角色：成员 */
	public static final int MEMBER = 4; 
	/** 角色：伙计 */
	public static final int STAFF = 8; 
	/** 角色：掌柜 */
	public static final int SHOPKEEPER = 16; 
	/** 角色：副帮主 */
	public static final int VICE_CHEAF = 32;
	/** 角色：帮主 */
	public static final int CHEAF = 64;
	/** 角色：副盟主 */
	public static final int MANAGER = 128;
	/** 角色：盟主 */
	public static final int SUPERMANAGER = 256;

	/**
	 * 角色标识混合值
	 */
	private Integer rid;

	/**
	 * 角色的名称
	 */
	@JsonInclude(JsonInclude.Include.NON_NULL)
	private String name;

	/**
	 * 角色的权限
	 */
	@JsonInclude(JsonInclude.Include.NON_NULL)
	private Integer purview = null;

	/**
	 * @since 1.0.0
	 * @roseuid 5B6D1B140126
	 */
	public EgRole() {

	}
	public EgRole(Integer rid, String name, Integer purview ) {
		this.rid = rid;
		this.name = name;
		this.purview = purview;
	}

	public Integer getRid() {
		return rid;
	}

	public void setRid(Integer rid) {
		this.rid = rid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getPurview() {
		return purview;
	}

	public void setPurview(Integer purview) {
		this.purview = purview;
	}
	
	public void or(EgRole role ) {
		this.rid = rid | role.rid;
		this.purview = purview | role.purview;
	}

	public void xor(EgRole role ) {
		this.rid = rid ^ role.rid;
		this.purview = purview ^ role.purview;
	}
}
